-
Notifications
You must be signed in to change notification settings - Fork 383
fix: Add Close Button to Animation Editor & Conditionally Show Save Button Across Windows #2689
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
ok, some main changes to happen here change 1 - all windows have to allow only the close button, (look at crafts, crafting table) |
| protected Button btnSave; | ||
| protected Button btnCancel; | ||
|
|
||
| protected void SetEditorButtons(Button saveButton, Button cancelButton) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the class fields are protected, that is, the children have access to the fields, this method is not necessary if the children can set them directly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, but I added SetEditorButtons just to make setup explicit and safer across forms, it's a small layer to avoid silent breakage and help with future logic reuse.
| @@ -0,0 +1,30 @@ | |||
| using System.Windows.Forms; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and nothing prevents these two properties and the UpdateEditorButtons method from being in the EditorForm file, so take them there to avoid more unnecessary inheritances for something so trivial, delete this file and return the original files to : EditorForm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EditorForm is handling lifecycle and hook, not UI controls. So I made the class to sit between , so we can isolate save/cancel for editor windows that use them. Every single form that inherits from it would get implicitly Save/Cancel logic. Over time, EditorForm will become a junk drawer for unrelated logic and new forms that don’t need Save/Cancel buttons are still carrying dead weight.
|
finally, in each editor, look for references to btnSave and btnCancel, and check if there are any warnings about possible null references, if there are, check before |
OK, done. All windows have only close button. |
|
@lodicolo could you please clarify what I messed up with the new commit? |
|
I didn't say anything was wrong, GitHub doesn't allow me to do something I tried to do, and the result is that it says I removed my request for review. |
pandinocoder
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm deferring to Weylon on this PR, I will approve when he has.


Enabled a visible Close button in Editor Windows.
The Save and Cancel button is now only shown when an item is selected
Showcase
Edit (Projectile Window fixed)
allwindows.mp4
Resolves #2688